package com.yuntuzhilian.chapter4;

/**
 * @author MrWang-shuizhishuiheshui
 * @description 线程强制
 */
public class Demo6 implements Runnable {

    @Override
    public void run() {
        for (int i = 0; i < 100; i++) {
            try {
                Thread.sleep(100);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println(Thread.currentThread().getName()+"****"+i);
        }
    }

    public static void main(String[] args) {
        Thread thread=new Thread(new Demo6());
        thread.start();
        for (int i = 0; i < 100; i++) {
            try {
                if (i==5){
                    thread.join();
                }
                Thread.sleep(100);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }

        }

    }
}
